We have written some samples to demonstrate the usage of domingo. You can find them in CVS in the samples package .
The following usage pattern shows how to write an agent and to access and modify the context document.
Please note the following:
DAgentBase getDSession as the starting point into the domingo API.public class AgentContext extends DAgentBase {
public void main() {
DDocument doc = getDSession().getAgentContext().getDocumentContext();
// do something with the document
doc.save();
}
}The following usage pattern shows how to write an agent and iterate over all unprocessed documents.
Please note the following:
Iterator from the Java collections APIpublic class AgentContext extends DAgentBase {
public void main() {
DDocumentCollection docs = getDSession().getAgentContext().getUnprocessedDocuments();
Iterator i = docs.getAllDocuments();
while (i.hasNext()) {
DDocument doc = (DDocument) i.next();
try {
// do something with the document
doc.save();
} catch (DNotesRuntimeException e) {
e.printStackTrace();
}
}
}
}The following usage pattern shows how to write a local client, access a view and iterate over all view entries. 'local client' means this application can be started directly in your Java development environment, outside of Lotus Notes.
Please note the following:
getInstance method of class DNotesFactory to get a starting point into the domingo APIpublic static void main(String[] args) throws DNotesException {
DNotesFactory factory = DNotesFactory.getInstance();
DSession session = factory.getSession();
DDatabase database = session.getDatabase("", "names.nsf");
DView view = database.getView("($Users)");
Iterator entries = view.getAllEntries();
while (entries.hasNext()) {
DViewEntry entry = (DViewEntry) entries.next();
System.out.println(entry.getColumnValues().get(0));
}
}